package edu.zju.gis.dbfg.model.etl;

import lombok.Getter;
import lombok.Setter;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Getter
@Setter
public class TileServiceFromTiffArgs {
    private final static Logger logger = LoggerFactory.getLogger(TileServiceFromTiffArgs.class);

    @Option(name = "-layerName", usage = "地图服务名称", required = true)
    private String layerName = "";
    @Option(name = "-tiffPath", usage = "输入文件", required = true)
    private String tiffPath = "";
    @Option(name = "-bandsSelected", usage = "需渲染波段", required = true)
    private String bandsArray = "";
    @Option(name = "-keywords", usage = "关键词", required = true)
    private String keyWords = "";
    @Option(name = "-topic", usage = "主题", required = true)
    private String topic = "";
    @Option(name = "-address", usage = "服务地址", required = true)
    private String tileServerAddress = "";
    @Option(name = "-userId", usage = "用户编号", required = true)
    private String userId = "";

    public static TileServiceFromTiffArgs initArgs(String args[]) {
        TileServiceFromTiffArgs mArgs = new TileServiceFromTiffArgs();
        CmdLineParser parser = new CmdLineParser(mArgs);
        try {
            parser.parseArgument(args);
            return mArgs;
        } catch (CmdLineException e) {
            logger.error(e.getLocalizedMessage());
            return null;
        }
    }
}
